﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using TouchRC.Classes;
using TouchRC.Custom_Controls.Events;

namespace TouchRC.Custom_Controls
{
    public class MenuOptionCollection : List<MainMenuItem>
    {
        public MenuOptionCollection()
            : base(MenuFactory.GetMenuItems())
        {
        }

        public event EventHandler<MenuOptionEventArgs> SelectedIndexChanged;

        private int m_SelectedIndex = -1;

        public int SelectedIndex 
        { 
            get { return m_SelectedIndex; } 
            set 
            {
                if (m_SelectedIndex != value)
                {
                    m_SelectedIndex = value;
                    if (SelectedIndexChanged != null)
                    {
                        MenuOptionEventArgs args = new MenuOptionEventArgs();
                        args.Options = this[m_SelectedIndex].Options;

                        SelectedIndexChanged(this, args);
                    }
                }
            } 
        }
    }
}
